function AllReady() {
    var mstform = Ext.getCmp("CntM7"); //获取容器
    var tabPanel = Ext.getCmp("tabPanel"); // 获取当前所在 tab 页
    var dgrid = Ext.getCmp("CntD7");
    var dstore = dgrid.store;
    var PhidYsfl = mstform.queryById("PhidYsfl");
    var PhidPc = mstform.getItem("PhidPc");
    var user_yztj_no = mstform.getItem("user_yztj_no");
    var user_djfa_no = mstform.getItem("user_djfa_no");

    var user_is_yztj = mstform.getItem("user_is_yztj");
    var toolbar = Ext.getCmp("toolbar");
    toolbar.get("imp").setText("引用采购/备品备件申请");
    toolbar.get("imp_push").setText("下推采购合同变更/要货单");
    // 新增“推送上上签”按钮
    var pushButton = toolbar.add({
        xtype: 'button',
        text: '推送上上签',
        id: 'pushBtn',
        iconCls: "icon-New",
        handler: function () {
            // 按钮点击后执行的逻辑，发送 AJAX 请求
            var phid = mstform.getItem("Phid").getValue(); // 假设 phid 存在于表单中
            var asrTable = mstform.getItem("asrTable").getValue(); // 假设 asrTable 存在于表单中

            // 拼接查询参数
            var url = 'http://nginx.clouddev.hisense.com/sd/Signed/push/uploadContract' +
                '?phid=' + phid +
                '&asrTable=' + asrTable;

            // 使用 GET 请求
            Ext.Ajax.request({
                url: url,
                method: 'POST',
                success: function (response) {
                    var res = Ext.decode(response.responseText);
                    if (res.success) {
                        Ext.Msg.alert('提示', '推送成功');
                    } else {
                        Ext.Msg.alert('错误', '推送失败');
                    }
                },
                failure: function () {
                    Ext.Msg.alert('错误', '请求失败，请稍后再试');
                }
            });
        }
    });


    if (otype == "add") {
        if (mstform.getItem("user_lj_amt").getValue()) {
        } else {
            mstform.getItem("user_lj_amt").setValue(0);
        }
        if (mstform.getItem("user_unpaid_amt").getValue()) {
        } else {
            mstform.getItem("user_unpaid_amt").setValue(0);
        }
        if (mstform.getItem("user_payable_amt").getValue()) {
        } else {
            mstform.getItem("user_payable_amt").setValue(0);
        }
        addContractTerms();
    }
    if (otype == "add") {
        if (mstform.getItem("PhidPc").getValue()) {
            getPtInfoByPhid();
        }
        PhidYsfl.setValue("14");
        BatchBindCombox([PhidYsfl]);
    }

    mstform.getItem("PhidPc").addListener("helpselected", function (args) {
        console.log("PhidPchelpselected", args);
        getPtInfoByPhid();
    });
    mstform.getItem("PhidSenComp").addListener("helpselected", function (args) {
        console.log("dgrid.getView().refresh()")
        dstore.each(function (record) {
            console.log(mstform.getItem("PhidSenComp").getValue(), "PhidSenComp");
            console.log(mstform.getItem("user_sjbm").getValue(), "user_sjbm");
            async function asfun() {
                try {
                    const res1 = await new Promise((resolve, reject) => {
                        execServer(
                            "autoSelectType",
                            { id: record.data.PhidItemId },
                            function (res) {
                                resolve(res);
                            }
                        );
                    });
                    const resWzxlData = JSON.parse(res1.data)[0].extendObjects;
                    const res2 = await new Promise((resolve, reject) => {
                        execServer(
                            "getAutoType",
                            { phid: resWzxlData.phid_resbs },
                            function (res) {
                                resolve(res);
                            }
                        );
                    });
                    const datas = JSON.parse(res2.data)[0].extendObjects;

                    record.set("user_item_xl_name", datas.name);
                    record.set("user_item_xl", resWzxlData.phid_resbs);
                    record.set("user_item_zl_name", datas.fname);
                    record.set("user_item_zl", datas.f_phid);
                    record.set("user_item_dl_name", datas.gname);
                    record.set("user_item_dl", datas.g_phid);
                    record.set("TaxRate", mstform.getValues().user_taxrate);
                    if (!record.data.PhidItemData) return; //判断是否为空
                    execServer(
                        "GETitemzq",
                        { phid: record.data.PhidItemData },
                        function (res) {
                            try {
                                const datas = JSON.parse(res.data);
                                let DHZQ = datas[0].extendObjects.pur_lead;
                                const newDate = addDaysToDate(
                                    mstform.getItem("BillDt").value,
                                    DHZQ
                                );
                                record.set("user_delivery_cycle", DHZQ);
                                record.set("user_exp_arrival_date", newDate);
                            } catch (error) {
                                Ext.Msg.alert("服务器错误，请联系管理员");
                            }
                        }
                    );
                } catch (error) {
                    console.error(error);
                }
            }
            if (!record.data.PhidItemId) return;
            record.set("ItemName", record.data.PhidItemId_EXName);
            record.set("ItemNo", record.data.ItemDataNo);
            console.log(mstform.getItem("PhidSenComp").getValue(), 'mstform.getItem("PhidSenComp").getValue()');
            if (mstform.getItem("PhidSenComp").getValue() && mstform.getItem("user_sjbm").getValue() && record.data.PhidItemId) {
                execServer(
                    "getBeforePrice",
                    {
                        comphid: mstform.getItem("PhidSenComp").getValue(),
                        sjbm: `'${mstform.getItem("user_sjbm").getValue()}'`,
                        itemphid: record.data.PhidItemId,
                    },
                    function (res) {
                        console.log(res, "getBeforePrice.res.data");
                        const datas = JSON.parse(res.data)[0].extendObjects;
                        console.log(datas, " getBeforePrice.res.data111");
                        try {

                            if (datas.hsprc) {
                                record.set("PrcVatFc", datas.hsprc);//含税价格
                            }
                            if (datas.taxrate) {
                                record.set("TaxRate", datas.taxrate);//税率
                            }
                            if (datas.wsprc) {
                                record.set("PrcFc", datas.wsprc);//未税价格
                            }

                            // 降成本额明细中的（评审价格-未税价格）*数量
                        } catch (error) {
                            console.log(error, "getBeforePriceError");
                        }
                    }
                );
            }
            asfun();
            dgrid.getView().refresh();
        });
    });
    user_yztj_no.on("beforetriggerclick", function (eOp, ignoreBeforeEvent) {
        console.log(
            'stform.getItem("user_sjbm").getValue()',
            mstform.getItem("user_sjbm").getValue()
        );
        if (Ext.isEmpty(PhidPc.getValue())) {
            Ext.Msg.alert("提示", "请先选择工程项目！"); //未选择提示：请先选择项目！
            return false;
        }
        user_yztj_no.setOutFilter({
            u_sj_no: mstform.getItem("user_sjbm").getValue(),
            u_sj_name: mstform.getItem("user_sjmc").getValue(),
        });
    });
    user_djfa_no.on("beforetriggerclick", function (eOp, ignoreBeforeEvent) {

        if (Ext.isEmpty(PhidPc.getValue())) {
            Ext.Msg.alert("提示", "请先选择工程项目！"); //未选择提示：请先选择项目！
            return false;
        }


        user_djfa_no.setOutFilter({
            u_sjh: mstform.getItem("user_sjbm").getValue(),
        });
    });
    user_djfa_no.addListener("helpselected", function (args) {
        console.log(args, 'user_djfa_noxx');
        console.log(args.data?.u_zbfs, 'user_djfa_noxx');

        mstform.getItem("user_djfs").setValue(args.data?.u_zbfs); //付款方式
        BatchBindCombox([mstform.getItem("user_djfs")])
        execServer(
            "getfkfs",
            {
                no: `'${args?.data?.bill_no}'`,
            },
            function (res) {
                try {
                    const datas = JSON.parse(res.data)[0].extendObjects;
                    mstform.getItem("user_fkfs").setValue(datas?.user_fkfs); //付款方式

                } catch (error) {
                    mstform.getItem("user_fkfs").setValue(""); //付款方式
                }
            }
        );


    })

    // dstore.on('add', function (store, records, index, eOpts) {//表体增行事件触发
    //     const count = dgrid.getStore().getCount()
    //     for(let i = 0;i<count;i++){
    //         dgrid.getStore().getAt(i).set("user_sfyztj",'1')
    //     }
    //     dstore.refresh()
    // });
    // setTimeout(()=>{
    //     dgrid.getStore().getAt(i).set("user_sfyztj",'1')
    // },2000)

    // 监听区域中心
    mstform
        .getItem("user_regional_center")
        .addListener("change", function (args) {
            mstform.getItem("user_regional_center").setValue(args.value); //区域中心
            BatchBindCombox([mstform.getItem("user_regional_center")]);
        });
    // 监听采购组织
    mstform.getItem("user_pur_org").addListener("change", function (args) {
        BatchBindCombox([mstform.getItem("user_pur_org")]);
    });
    // 监听采购合同税率
    mstform.getItem("user_taxrate").addListener("change", function (args) {
        console.log(args);
        // mstform.getValues().user_taxrate;
        console.log(mstform.getValues().user_taxrate);
        dstore.each(function (item) {
            item.set("TaxRate", mstform.getValues().user_taxrate);
        });
    });
    // 监听业主推荐单号
    mstform.getItem("user_yztj_no").addListener("change", function (args) {
        if (args.value == 1) {
            execServer(
                "GETyztj",
                {
                    pc: mstform.getItem("pc").getValue(),
                },
                function (res) {
                    const datas = JSON.parse(res.data)[0].extendObjects;
                }
            );
        }
    });

    mstform.getItem("PhidSenComp").addListener("change", function (args) {
        if (!mstform.getItem("PhidSenComp").getValue()) return;
        try {
            execServer(
                "GETlinkman",
                {
                    ent: mstform.getItem("PhidSenComp").getValue(),
                },
                function (res) {
                    const datas = JSON.parse(res.data)[0].extendObjects;
                    // 植物user_duties  mainrole
                    mstform.getItem("user_duties").setValue(datas.mainrole); //职务
                    mstform.getItem("user_contact_information").setValue(datas.handset); //联系方式
                    mstform.getItem("user_payee").setValue(datas.phid); //收款方
                    console.log(`社会信用代码`,datas,datas.unisocialcredit);
                    BatchBindCombox([mstform.getItem("user_payee")]);
                    mstform.getItem("user_bank_account").setValue(datas.accountno); //银行卡
                    mstform.getItem("user_ghf_contacts").setValue(datas.cname); //供方联系人
                    mstform.getItem("user_mailbox").setValue(datas.email); //供方联系人
                    console.log("业主推荐", datas);
                }
            );
            execServer(
                "getEnterpriseInfoByPhid",
                {
                    phid: mstform.getItem("PhidSenComp").getValue(),
                },
                function (res) {
                    const datas = JSON.parse(res.data)[0].extendObjects; // 植物user_duties  mainrole
                    mstform.getItem("user_khbank").setValue(datas.taxbankname); //开户银行
                    mstform.getItem("user_supply_address").setValue(datas.taxaddress); //注册地址
                    mstform.getItem("user_bankno").setValue(datas.bankno); //开户银行行号
                    mstform.queryById("user_tyshxydm").setValue(datas.unisocialcredit); //社会信用代码
                    // mstform.getItem("user_sh").setValue(datas.); //税号
                    // mstform.getItem("user_yzbm").setValue(datas.); //税号
                    console.log("业主推荐", datas);
                }
            );
        } catch (error) {
            console.log("未查找到联系人");
        }
    });

    //申请部门//申请人111//采购组织
    if (otype == "add" || otype == "copy" || otype == "edit") {
        execServer("GETuserdept", { phid: $appinfo.userID }, function (res) {
            const datas = JSON.parse(res.data)[0].extendObjects;
            if (res.count > 0) {
                mstform.getItem("user_apply_dept").setValue(datas.dept_id); //申请部门
                mstform.getItem("PhidCm").setValue(datas.hrid); //申请人111
                BatchBindCombox([mstform.getItem("user_apply_dept")]);
                BatchBindCombox([mstform.getItem("PhidCm")]);
            }
        });
        if ($appinfo.ocode) {
            execServer("GETORG", { code: $appinfo.ocode }, function (res) {
                const datas = JSON.parse(res.data)[0].extendObjects;
                if (res.count > 0) {
                    mstform.getItem("user_pur_org").setValue("" + datas.phid); //采购组织
                }
            });
        }
    }

    /**
     *@function:带出项目信息
     */
    function getPtInfoByPhid() {
        console.log("带出项目信息", "??");
        if (mstform.getItem("PhidPc").getValue()) {
            execServer(
                "getPtInfoByPhid",
                { phid: mstform.getItem("PhidPc").getValue() },
                function (res) {
                    const datas = JSON.parse(res.data)[0].extendObjects;
                    console.log(datas);
                    mstform
                        .getItem("user_regional_center")
                        .setValue(datas.regional_center_phid); //区域中心
                    mstform.getItem("PhidPm").setValue(datas.project_manager_phid); //项目经理
                    mstform.getItem("SenEmp").setValue(datas.user_sqgw_phid); //部门商务
                    mstform.getItem("user_sjbm").setValue(datas.user_sjbm); //部门商务
                    mstform.getItem("user_product_line").setValue(datas.midwife_phid)
                    BatchBindCombox([mstform.getItem("user_regional_center")]);
                    BatchBindCombox([mstform.getItem("user_project_manager")]);
                    BatchBindCombox([mstform.getItem("SenEmp")]);
                    BatchBindCombox([mstform.getItem("PhidPm")]);
                    BatchBindCombox([mstform.getItem("user_product_line")]);
                    //获取业主推荐
                    getYztjWl()

                }
            );

            execServer(
                "projectSjbm",
                { phid: mstform.getItem("PhidPc").getValue() },
                async function (res) {
                    const datas = JSON.parse(res.data)[0].extendObjects;
                    mstform.getItem("user_sjbm").setValue(datas.user_sjbm); //
                    mstform.getItem("user_sjmc").setValue(datas.user_sjmc); //
                    BatchBindCombox([mstform.getItem("user_sjbm")]);
                    BatchBindCombox([mstform.getItem("user_sjmc")]);

                    await execServer(
                        "isYzPush",
                        { sjno: "'" + datas.user_sjbm + "'" },
                        function (res1) {
                            console.log(res1.data, "isYzPush");
                            if (res1.data.length > 0) {
                                mstform.getItem("user_is_yztj").setValue("1");
                            } else {
                                mstform.getItem("user_is_yztj").setValue("0");
                            }
                            BatchBindCombox([mstform.getItem("user_is_yztj")]);
                        }
                    );
                }
            );
            dstore.each(function (record) {
                console.log(mstform.getItem("PhidSenComp").getValue(), "PhidSenComp");
                console.log(mstform.getItem("user_sjbm").getValue(), "user_sjbm");
                async function asfun() {
                    try {
                        const res1 = await new Promise((resolve, reject) => {
                            execServer(
                                "autoSelectType",
                                { id: record.data.PhidItemId },
                                function (res) {
                                    resolve(res);
                                }
                            );
                        });
                        const resWzxlData = JSON.parse(res1.data)[0].extendObjects;
                        const res2 = await new Promise((resolve, reject) => {
                            execServer(
                                "getAutoType",
                                { phid: resWzxlData.phid_resbs },
                                function (res) {
                                    resolve(res);
                                }
                            );
                        });
                        const datas = JSON.parse(res2.data)[0].extendObjects;

                        record.set("user_item_xl_name", datas.name);
                        record.set("user_item_xl", resWzxlData.phid_resbs);
                        record.set("user_item_zl_name", datas.fname);
                        record.set("user_item_zl", datas.f_phid);
                        record.set("user_item_dl_name", datas.gname);
                        record.set("user_item_dl", datas.g_phid);
                        record.set("TaxRate", mstform.getValues().user_taxrate);
                        if (!record.data.PhidItemData) return; //判断是否为空
                        execServer(
                            "GETitemzq",
                            { phid: record.data.PhidItemData },
                            function (res) {
                                try {
                                    const datas = JSON.parse(res.data);
                                    let DHZQ = datas[0].extendObjects.pur_lead;
                                    const newDate = addDaysToDate(
                                        mstform.getItem("BillDt").value,
                                        DHZQ
                                    );
                                    record.set("user_delivery_cycle", DHZQ);
                                    record.set("user_exp_arrival_date", newDate);
                                } catch (error) {
                                    Ext.Msg.alert("服务器错误，请联系管理员");
                                }
                            }
                        );
                    } catch (error) {
                        console.error(error);
                    }
                }
                if (!record.data.PhidItemId) return;
                record.set("ItemName", record.data.PhidItemId_EXName);
                record.set("ItemNo", record.data.ItemDataNo);
                console.log(mstform.getItem("PhidSenComp").getValue(), 'mstform.getItem("PhidSenComp").getValue()');
                if (mstform.getItem("PhidSenComp").getValue() && mstform.getItem("user_sjbm").getValue() && record.data.PhidItemId) {
                    execServer(
                        "getBeforePrice",
                        {
                            comphid: mstform.getItem("PhidSenComp").getValue(),
                            sjbm: `'${mstform.getItem("user_sjbm").getValue()}'`,
                            itemphid: record.data.PhidItemId,
                        },
                        function (res) {
                            console.log(res, "getBeforePrice.res.data");
                            const datas = JSON.parse(res.data)[0].extendObjects;
                            console.log(datas, " getBeforePrice.res.data111");
                            try {

                                if (datas.hsprc) {
                                    record.set("PrcVatFc", datas.hsprc);//含税价格
                                }
                                if (datas.taxrate) {
                                    record.set("TaxRate", datas.taxrate);//税率
                                }
                                if (datas.wsprc) {
                                    record.set("PrcFc", datas.wsprc);//未税价格
                                }

                                // 降成本额明细中的（评审价格-未税价格）*数量
                            } catch (error) {
                                console.log(error, "getBeforePriceError");
                            }
                        }
                    );
                }


                asfun();
            console.log(`异步发生end`);

            });
        }
    }
    //监听 物料名称
    dgrid
        .getColumn("PhidItemId_EXName")
        .getEditor()
        .addListener("helpselected", function (record) {
            var data = dgrid.getSelectionModel().getSelection();
            data[0].set("ItemName", data[0].data.PhidItemId_EXName);
            data[0].set("ItemNo", data[0].data.ItemDataNo);
            execServer("autoSelectType", { id: record.data.PhId }, function (res) {
                let resWzxlData = JSON.parse(res.data)[0].extendObjects;
                if (res.status == "success") {
                    execServer(
                        "getAutoType",
                        { phid: resWzxlData.phid_resbs },
                        function (res) {
                            const datas = JSON.parse(res.data)[0].extendObjects;
                            data[0].set("user_item_xl_name", datas.name);
                            data[0].set("user_item_xl", resWzxlData.phid_resbs);
                            data[0].set("user_item_zl_name", datas.fname);
                            data[0].set("user_item_zl", datas.f_phid);
                            data[0].set("user_item_dl_name", datas.gname);
                            data[0].set("user_item_dl", datas.g_phid);
                        }
                    );
                } else {
                    Ext.Msg.alert("未查询到该物资类型");
                }
            });
        });

    dstore.on("datachanged", async function (dstore, eOpts) {
        dstore.each(function (record) {
            console.log(mstform.getItem("PhidSenComp").getValue(), "PhidSenComp");
            console.log(mstform.getItem("user_sjbm").getValue(), "user_sjbm");
            async function asfun() {
                try {
                    const res1 = await new Promise((resolve, reject) => {
                        execServer(
                            "autoSelectType",
                            { id: record.data.PhidItemId },
                            function (res) {
                                resolve(res);
                            }
                        );
                    });
                    const resWzxlData = JSON.parse(res1.data)[0].extendObjects;
                    const res2 = await new Promise((resolve, reject) => {
                        execServer(
                            "getAutoType",
                            { phid: resWzxlData.phid_resbs },
                            function (res) {
                                resolve(res);
                            }
                        );
                    });
                    const datas = JSON.parse(res2.data)[0].extendObjects;

                    record.set("user_item_xl_name", datas.name);
                    record.set("user_item_xl", resWzxlData.phid_resbs);
                    record.set("user_item_zl_name", datas.fname);
                    record.set("user_item_zl", datas.f_phid);
                    record.set("user_item_dl_name", datas.gname);
                    record.set("user_item_dl", datas.g_phid);
                    record.set("TaxRate", mstform.getValues().user_taxrate);
                    if(window.catch_yztj[mstform.getItem("user_sjbm").getValue()].indexOf(record.get("PhidItemdata"))==-1){
                        record.set("user_sfyztj",'0')
                    } else {
                        record.set("user_sfyztj",'1')
                    }
                    
                    if (!record.data.PhidItemData) return; //判断是否为空
                    execServer(
                        "GETitemzq",
                        { phid: record.data.PhidItemData },
                        function (res) {
                            try {
                                const datas = JSON.parse(res.data);
                                let DHZQ = datas[0].extendObjects.pur_lead;
                                const newDate = addDaysToDate(
                                    mstform.getItem("BillDt").value,
                                    DHZQ
                                );
                                record.set("user_delivery_cycle", DHZQ);
                                record.set("user_exp_arrival_date", newDate);
                            } catch (error) {
                                Ext.Msg.alert("服务器错误，请联系管理员");
                            }
                        }
                    );
                } catch (error) {
                    console.error(error);
                }
            }
            if (!record.data.PhidItemId) return;
            record.set("ItemName", record.data.PhidItemId_EXName);
            record.set("ItemNo", record.data.ItemDataNo);
            if (mstform.getItem("PhidSenComp").getValue() && mstform.getItem("user_sjbm").getValue() && record.data.PhidItemId) {
                execServer(
                    "getBeforePrice",
                    {
                        comphid: mstform.getItem("PhidSenComp").getValue(),
                        sjbm: `'${mstform.getItem("user_sjbm").getValue()}'`,
                        itemphid: record.data.PhidItemId,
                    },
                    function (res) {
                        console.log(res, "getBeforePrice.res.data");
                        const datas = JSON.parse(res.data)[0].extendObjects;
                        try {

                            if (datas.hsprc) {
                                record.set("PrcVatFc", datas.hsprc);//含税价格
                            }
                            if (datas.taxrate) {
                                record.set("TaxRate", datas.taxrate);//税率
                            }
                            if (datas.wsprc) {
                                record.set("PrcFc", datas.wsprc);//未税价格
                            }

                            // 降成本额明细中的（评审价格-未税价格）*数量
                        } catch (error) {
                            console.log(error, "getBeforePriceError");
                        }
                    }
                );
            }

            asfun();
        });
            console.log(`异步发生`);
            SetTotal();
    });
    function SetTotal() {
        var total = 0; //金额
        // 遍历 dstore 中的每个项
        dstore.each(function (item) {
            // 转换为数字

            let PlanPrc = Ext.Number.from(item.get("PlanPrc"), 0);
            let PrcFc = Ext.Number.from(item.get("PrcFc"), 0);
            let Qty = Ext.Number.from(item.get("Qty"), 0);
            if (!PlanPrc || !PrcFc || !Qty) return;
            total += (PlanPrc - PrcFc) * Qty;
        });
        console.log(
            total,
            "111111111111111111111111111111111111111111111111????????????????????"
        );
        mstform.getItem("user_jcb_amt").setValue(total);
    }
    //获取业主推荐的物料明细
    getYztjWl()
    function getYztjWl(){
        setTimeout(()=>{
            const sjh = mstform.queryById("user_sjbm").getValue();
				console.log(`商机号`, sjh);
				if (!sjh) return;
				execServer("getYztjsqWl", { sjh }, (res) => {
                    console.log(`请求数据`,res);
					if (res.count == 0) return;
					const _data = JSON.parse(res.data);
					//整理数据并缓存
					window.catch_yztj = _data.reduce((value, items, index) => {
						const item = items.extendObjects;
						if (value[item.sjh]) {
							value[item.sjh].push(item.item_data);
						} else {
							value[item.sjh] = [item.item_data];
						}
						return value;
					}, {});
					console.log(`业主推荐数据`, window.catch_yztj);
				});
        },500)
        
    }
    function addContractTerms(params) {
        console.log("addContractTerms");
        tabPanel.setActiveTab(2);
        var dgrid3 = Ext.getCmp("cntitemtab").items.items[0].items.items[0];
        if (dgrid3) {
            console.log(dgrid3, "dgrid3");
            // var GridID = Ext.getElementById(Ext.getElementById(Ext.getElementById(Ext.getElementById(Ext.getElementById(Ext.getElementById("cntitemtab-innerCt").children[0].id).children[0].id).children[0].id).children[0].id).children[2].id).children[0].id;
            // var grid1 = Ext.getCmp(GridID);
            let datas = [];
            datas.push(
                {
                    NameNew: "预付款",
                    PayType: "0",
                    Remarks: "",
                    PayProptyNew: "2",
                    PayBaseTypeNew: "1",
                    PhidItem: 8570000000000001,
                    PhidItemNew: 8570000000000001,
                },
                // {
                // 	NameNew: "结算付款",
                // 	PayType: "1",
                // 	Remarks: "111",
                // 	PayProptyNew: "2",
                // 	PayBaseTypeNew: "1",
                // },
                // {
                // 	NameNew: "进度款",
                // 	PayType: "1",
                // 	Remarks: "111",
                // 	PayProptyNew: "2",
                // 	PayBaseTypeNew: "1",
                // },
                {
                    NameNew: "设备到货",
                    PayType: "1",
                    Remarks: "",
                    PayProptyNew: "2",
                    PayBaseTypeNew: "1",
                    PhidItem: 8570000000000008,
                    PhidItemNew: 8570000000000008,
                },
                {
                    NameNew: "安装调试款",
                    PayType: "1",
                    Remarks: "",
                    PayProptyNew: "2",
                    PayBaseTypeNew: "1",
                    PhidItem: 8570000000000005,
                    PhidItemNew: 8570000000000005,
                },
                {
                    NameNew: "验收款",
                    PayType: "1",
                    Remarks: "",
                    PayProptyNew: "2",
                    PayBaseTypeNew: "1",
                    PhidItem: 8570000000000004,
                    PhidItemNew: 8570000000000004,
                },
                // {
                // 	NameNew: "审计款",
                // 	PayType: "1",
                // 	Remarks: "111",
                // 	PayProptyNew: "2",
                // 	PayBaseTypeNew: "1",
                // },
                {
                    NameNew: "质保金",
                    PayType: "1",
                    Remarks: "",
                    PayProptyNew: "2",
                    PayBaseTypeNew: "1",
                    PhidItem: 8570000000000007,
                    PhidItemNew: 8570000000000007,
                }

                // {
                // 	NameNew: "安装完成",
                // 	PayType: "1",
                // 	Remarks: "111",
                // 	PayProptyNew: "2",
                // 	PayBaseTypeNew: "1",
                // },
                // {
                // 	NameNew: "调试完成",
                // 	PayType: "1",
                // 	Remarks: "111",
                // 	PayProptyNew: "2",
                // 	PayBaseTypeNew: "1",
                // }
            );
            dgrid3.store.add(datas);
        }
        tabPanel.setActiveTab(0);
    }

}

//计算结算信息中的逻辑

//到货周期时间计算
function addDaysToDate(dateString, daysToAdd) {
    // 将字符串解析为Date对象
    const date = new Date(dateString);

    // 检查是否有效日期ca
    if (isNaN(date)) {
        throw new Error("Invalid date string");
    }
    // 增加指定的天数
    date.setDate(date.getDate() + daysToAdd);

    return date;
}
